CreateJsonWithFile=function(filename){
    if(filename){
        cc.log("load json with file: "+filename);
        var jsonFile = cc.loader._loadTxtSync(filename);
        //var jsonFile = jsb.fileUtils.getStringFromFile(filename)
        var jsonObj = JSON.parse(jsonFile);
        if(jsonObj){
            return jsonObj;
        }else{
            cc.log("parse json file: "+filename +" fail");
            return null;
        }
    }else{
        cc.log("error: "+filename+" json file name should not be null");
        return null;
    }
}
PixelToPoint=function(jsonObj,pixel){
    var roadWidth = jsonObj.width;
    var roadHeight = jsonObj.height;
    cc.log("pixel x: "+pixel.x+" y: "+pixel.y);
    var point = cc.p( parseInt(pixel.x/roadWidth),parseInt(pixel.y/roadHeight) );
    cc.log("point x: "+point.x+" y: "+point.y);
    return point;
}
pointToPixel=function(jsonObj,point){
    var roadWidth = jsonObj.width;
    var roadHeight = jsonObj.height;
    cc.log("point x: "+point.x+" y: "+point.y);
    var pixel = cc.p( point.x*roadWidth,point.y*roadHeight );
    cc.log("pixel x: "+pixel.x+" y: "+pixel.y);
    return pixel;
}
PointInMapRect=function(point){
    if ( point.x < 2 || point.x > 11 ||
        point.y < 1 || point.y > 7 ){
        cc.log("point not in custom rect");
        return false;
    }
    return true;
}
var MapResource=function(name){
    return "res/main/"+name;
}